<?php
require_once './connect.php';
//[{dep_name:"",dep_id:""}]
//获取数据库信息
$sql = "SELECT dep_id,dep_name FROM _department";
$result = $conn->query($sql);
$datalist=array();
if($result->num_rows>0){
    while($row=$result->fetch_assoc()){
        $datasingle=array('dep_name'=>$row['dep_name'],
            'dep_id'=>$row['dep_id']);
        array_push($datalist,$datasingle);
    }
}
$datalist=array('dataList' => $datalist);
$response=array(
    'resultCode'=>'0',
    'resultObject'=> $datalist,
    'resultMsg'=>'成功'
);
//echo 'test';
echo json_encode($response);
$conn->close();
?>